<?php

/**
 * KTDCharacter form base class.
 *
 * @method KTDCharacter getObject() Returns the current form's model object
 *
 * @package    s-test
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseKTDCharacterForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'player_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('KTDPlayer'), 'add_empty' => false)),
      'act_count'        => new sfWidgetFormInputText(),
      'is_valid'         => new sfWidgetFormInputText(),
      'avatar'           => new sfWidgetFormInputText(),
      'avatar_thumbnail' => new sfWidgetFormInputText(),
      'pseudo'           => new sfWidgetFormInputText(),
      'edition_number'   => new sfWidgetFormInputText(),
      'hide_player'      => new sfWidgetFormInputText(),
      'signature'        => new sfWidgetFormInputText(),
      'color'            => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'player_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('KTDPlayer'))),
      'act_count'        => new sfValidatorInteger(array('required' => false)),
      'is_valid'         => new sfValidatorPass(array('required' => false)),
      'avatar'           => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'avatar_thumbnail' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'pseudo'           => new sfValidatorString(array('max_length' => 255)),
      'edition_number'   => new sfValidatorInteger(array('required' => false)),
      'hide_player'      => new sfValidatorPass(array('required' => false)),
      'signature'        => new sfValidatorPass(array('required' => false)),
      'color'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'KTDCharacter', 'column' => array('pseudo')))
    );

    $this->widgetSchema->setNameFormat('ktd_character[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'KTDCharacter';
  }

}
